import 'package:enterprise_v6_app/app/components/custom_modele/custom_field.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_picker_photo.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/list.dart';
import 'package:enterprise_v6_app/app/modules/application/education/personal_profile/cert/cert_controller.dart';

const _blue = Color(0xFF5C6DFF);

class EducationProfileCertView extends StatelessWidget {
  EducationProfileCertView({super.key});

  final controller = Get.put(EducationProfileCertController());

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Container(
          height: 532.w,
          width: 287.w,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10.w),
          ),
          child: Column(
            children: <Widget>[
              CustomField(
                title: '证件名称',
                titleStyle: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w500),
                right: CustomField.input(),
              ),
              CustomPickerPhoto(
                title: '证件照片',
                maxCount: 9,
                imagesList: controller.certUrls,
                titleTextStyle: TextStyle(
                  fontSize: 14.sp,
                  height: 1.2,
                  fontWeight: FontWeight.w500,
                  color: const Color(0xff262F38),
                ),
                callback: (path) {
                  controller.certUrls.addAll(path);
                  controller.onSaveChanges();
                },
              ).paddingSymmetric(horizontal: 16.w),
            ].joinWith(Divider(
              height: 1.w,
              color: const Color(0xffECEEF3),
            )),
          ),
        ),
        _buildBottom(),
      ],
    );
  }

  Widget _buildBottom() {
    return Padding(
      padding: EdgeInsets.symmetric(vertical: 5.w),
      child: InkWell(
        onTap: () {},
        child: Container(
          padding: EdgeInsets.symmetric(vertical: 9.w),
          decoration: BoxDecoration(
            color: _blue,
            borderRadius: BorderRadius.circular(44.w),
          ),
          alignment: Alignment.center,
          child: Text(
            '更新基本信息',
            style: TextStyle(
              fontSize: 16.w,
              color: Colors.white,
            ),
          ),
        ),
      ),
    );
  }
}
